From: Álvaro Fernández Rojas Date: Mon, 3 Nov 2025 11:29:46 +0000 (+0100) Subject: odhcp6c: add a simple build script X-Git-Url: http://git.openwrt.org/%22https:/collectd.org//%22%24PHP_SELF/%22https:/collectd.org/%22%24PHP_SELF?a=commitdiff_plain;h=b929fc8a1cfdb003a0c7094e34d74ba6ef914b08;p=project%2Fodhcp6c.git odhcp6c: add a simple build script Should make it a little bit easier for people who want to contribute. Link: https://github.com/openwrt/odhcp6c/pull/110 Signed-off-by: Álvaro Fernández Rojas --- diff --git a/.gitignore b/.gitignore index 4c784af..83eb1f8 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ .project .cproject +build odhcp6c config.log CMakeCache.txt @@ -11,4 +12,3 @@ Makefile cmake_install.cmake install_manifest.txt *.deb - diff --git a/scripts/devel-build.sh b/scripts/devel-build.sh new file mode 100755 index 0000000..807f2a4 --- /dev/null +++ b/scripts/devel-build.sh @@ -0,0 +1,68 @@ +#!/bin/bash + +set -euxo pipefail +cd "${0%/*}" +cd .. + +# Sanity checks +if [ ! -e "CMakeLists.txt" ] || [ ! -e "src/odhcp6c.c" ]; then + echo "odhcp6c checkout not found" >&2 + exit 1 +fi + +if [ $# -eq 0 ]; then + BUILD_ARGS="" +else + BUILD_ARGS="$@" +fi + +# Create build dirs +ODHCP6CDIR="$(pwd)" +BUILDDIR="${ODHCP6CDIR}/build" +DEPSDIR="${BUILDDIR}/depends" +[ -e "${BUILDDIR}" ] || mkdir "${BUILDDIR}" +[ -e "${DEPSDIR}" ] || mkdir "${DEPSDIR}" + +# Download deps +cd "${DEPSDIR}" +[ -e "json-c" ] || git clone https://github.com/json-c/json-c.git +[ -e "libubox" ] || git clone https://github.com/openwrt/libubox.git + +# Build json-c +cd "${DEPSDIR}/json-c" +cmake \ + -S . \ + -B . \ + -DCMAKE_PREFIX_PATH="${BUILDDIR}" \ + -DBUILD_SHARED_LIBS=OFF \ + -DDISABLE_EXTRA_LIBS=ON \ + --install-prefix "${BUILDDIR}" +make +make install + +# Build libubox +cd "${DEPSDIR}/libubox" +cmake \ + -S . \ + -B . \ + -DCMAKE_PREFIX_PATH="${BUILDDIR}" \ + -DBUILD_LUA=OFF \ + -DBUILD_EXAMPLES=OFF \ + --install-prefix "${BUILDDIR}" +make +make install + +# Build odhcp6c +cd "${ODHCP6CDIR}" +cmake \ + -S . \ + -B "${BUILDDIR}" \ + -DCMAKE_PREFIX_PATH="${BUILDDIR}" \ + ${BUILD_ARGS} +make -C "${BUILDDIR}" + +set +x +echo "✅ Success - the odhcp6c binary is available at ${BUILDDIR}/odhcp6c" +echo "👷 You can rebuild odhcp6c by running 'make -C build'" + +exit 0